<?php
namespace App\Controllers;

use App\Core\Container;

class BaseController {
    protected $container;

    public function __construct() {
        $this->container = new Container();
    }

    // 渲染视图
    protected function view($view, $data = []) {
        extract($data);
        $viewPath = __DIR__ . "/../Views/{$view}.php";
        if (file_exists($viewPath)) {
            require $viewPath;
        } else {
            throw new \Exception("View {$view} not found");
        }
    }
}